package com.leyou.item.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.leyou.item.pojo.Brand;
import com.leyou.item.pojo.Category;
import org.apache.ibatis.annotations.*;

import java.util.List;
@Mapper
public interface BrandMapper extends BaseMapper<Brand> {
    @Insert("INSERT INTO tb_category_brand(category_id, brand_id) VALUES (#{cid},#{bid})")
    int insertCategoryAndBrand(@Param("cid") Long cid, @Param("bid") Long bid);
    @Delete("delete from tb_category_brand where brand_id = #{bid}")
    int deleteCategoryAndBrand(@Param("bid") Long bid);
    @Select("select * from tb_brand where id in ( select brand_id from tb_category_brand where category_id = #{cid})")
    List<Brand> selectByCid(@Param("cid") Long cid);
}
